<template>
  <div>
    <my-header></my-header>
    <main>
      <!-- 首页，各种切换入口 -->
      <div class="index-content d-flex">
        <div class="index-all text-center">全部商品分类</div>
        <div class="index-nav" style="color: #cc1f3a">现货商城</div>
        <div class="index-nav">期货商城</div>
        <div class="index-nav">卡卷兑换</div>
        <div class="index-nav">服务咨询</div>
      </div>
      <!-- 轮播图和三级分类 -->
      <div class="index-banner" style="height: 400px" >
        <!-- 轮播图部分 -->
        <div class="block">
          <el-carousel height="400px">
            <el-carousel-item v-for="(item, key) of this.c" :key="key">
              <img :src="item.img" alt="" />
            </el-carousel-item>
          </el-carousel>
        </div>
        <!-- 三级菜单 -->
        <div class="home-five-style">
          <div class="home-five-detail">
            <!-- 直接显示的三级分类 -->
            <div class="three-look-details" id="showOneThree">
              <!-- 具体分类项 -->
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>活鲜水产</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>冰鲜水产</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>冷冻水产</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>精品礼盒</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>猪牛羊肉</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>鸡鸭肉禽</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>蔬果生鲜</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>米面粮油</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>调味干货</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>休闲酒饮</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
              <div class="three big" firsted="10">
                <div class="home-have-line">
                  <div class="first-class">
                    <span class="fish-small"></span><span>餐厨用品</span
                    ><span>&gt;</span>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- 隐藏的二级三级分类 -->
          <div class="show-two-three"></div>
        </div>
      </div>
      <!-- 热门推荐 -->
      <div class="home-hot-record" @click="golist">
        <div class="home-hot-word">热门推荐</div>
        <div class="four-recond">
          <img :src="v.pic" alt="" v-for="(v, i) of this.h" :key="i" />
        </div>
      </div>
      <!-- 鱼类专区 -->
      <div class="fish" @click="golist">
        <!-- 鱼类文字 -->
        <div class="fish-word im-cursor">
          <span class="fish-fine-line"></span>
          <span class="fish-coarse-line"></span>
          <span class="fish-big">鱼类专区</span>
          <span class="fish-coarse-line"></span>
          <span class="fish-fine-line"></span>
          <p class="fish-more">
            <span>更多鱼类</span>
            <img src="https://www.ewfresh.com/images/seaMore2.png" alt="" />
          </p>
        </div>
        <!-- 鱼类信息 -->
        <div class="fish-detail">
          <div class="fish-one">
            <img :src="f1.pic" alt="" />
          </div>
          <div class="fish-two">
            <div class="fish-small">
              <img :src="f2.pic" alt="" />
              <div class="fish-six">
                <img
                  :src="v.pic"
                  alt=""
                  v-for="(v, i) of this.f_other"
                  :key="i"
                />
              </div>
            </div>
          </div>
          <div class="fish-three">
            <img :src="f3.pic" alt="" />
            <img :src="f4.pic" alt="" />
          </div>
        </div>
      </div>
      <!-- 虾类专区 -->
      <div class="shrimp" @click="golist">
        <!-- 虾类文字 -->
        <div class="shrimp-word im-cursor">
          <span class="shrimp-fine-line"></span>
          <span class="shrimp-coarse-line"></span>
          <span class="shrimp-big">虾类专区</span>
          <span class="shrimp-coarse-line"></span>
          <span class="shrimp-fine-line"></span>
          <p class="shrimp-more">
            <span>更多虾类</span>
            <img src="https://www.ewfresh.com/images/seaMore2.png" alt="" />
          </p>
        </div>
        <!-- 虾类信息 -->
        <div class="shrimp-detail d-flex">
          <!-- 左边部分 -->
          <div class="shrimp-one">
            <img :src="this.s1.pic" alt="" />
          </div>
          <!-- 右边部分 -->
          <div class="shrimp-two">
            <!-- 右上部 -->
            <div class="shrimp-up">
              <!-- 冻品专区 -->
              <div class="home-up-word">
                <span class="shrimp-ice">冻品专区</span>
                <img
                  src="https://www.ewfresh.com/images/iceLogo.png"
                  alt=""
                  class="wid-th-fi"
                />
              </div>
              <div class="home-up-img">
                <img :src="v.pic" alt="" v-for="(v, i) of this.s2" :key="i" />
              </div>
            </div>
            <!-- 右下部 -->
            <div class="shrimp-down">
              <div class="home-shrimp-size">
                <img
                  :src="v.pic"
                  alt=""
                  class="home-lr-size"
                  v-for="(v, i) of this.s3"
                  :key="i"
                />
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 螃蟹类 -->
      <div class="crab" @click="golist">
        <!-- 文字 -->
        <div class="crab-word im-cursor">
          <span class="crab-fine-line"></span>
          <span class="crab-coarse-line"></span>
          <span class="crab-big">蟹类专区</span>
          <span class="crab-coarse-line"></span>
          <span class="crab-fine-line"></span>
          <p class="crab-more">
            <span>更多蟹类</span>
            <img src="https://www.ewfresh.com/images/seaMore2.png" alt="" />
          </p>
        </div>
        <!-- 螃蟹具体内容 -->
        <div class="crab-deatil">
          <div class="crab-one">
            <img :src="this.c2.pic" alt="" />
            <img :src="this.c3.pic" alt="" />
          </div>
          <div class="crab-two">
            <img :src="this.c1.pic" alt="" class="w-100 h-100" />
          </div>
          <div class="crab-three" style="background-color: #fff; margin: 0">
            <div class="crab-small">
              <div class="crab-word">
                <span class="new-goods">帝王蟹专区</span>
                <img
                  src="https://www.ewfresh.com/images/iceLogo.png"
                  alt=""
                  class="wid-th-fi"
                />
              </div>
              <img :src="this.c6.pic" alt="" class="premium-up" />
              <img :src="this.c4.pic" alt="" />
              <img :src="this.c5.pic" alt="" />
            </div>
          </div>
        </div>
      </div>
      <!-- 贝类专区 -->
      <div class="bei" @click="golist">
        <!-- 虾类文字 -->
        <div class="bei-word im-cursor">
          <span class="bei-fine-line"></span>
          <span class="bei-coarse-line"></span>
          <span class="bei-big">贝类专区</span>
          <span class="bei-coarse-line"></span>
          <span class="bei-fine-line"></span>
          <p class="bei-more">
            <span>更多贝类</span>
            <img src="https://www.ewfresh.com/images/seaMore2.png" alt="" />
          </p>
        </div>
        <!-- 贝类信息 -->
        <div class="bei-detail d-flex">
          <!-- 左边部分 -->
          <div class="bei-one">
            <img :src="this.b1.pic" alt="" />
          </div>
          <!-- 右边部分 -->
          <div class="bei-two">
            <!-- 右上部 -->
            <div class="bei-up">
              <!-- 冻品专区 -->
              <div class="home-up-word">
                <span class="bei-ice">冻品专区</span>
                <img
                  src="https://www.ewfresh.com/images/iceLogo.png"
                  alt=""
                  class="wid-th-fi"
                />
              </div>
              <div class="home-up-img">
                <img :src="v.pic" alt="" v-for="(v, i) of this.b2" :key="i" />
              </div>
            </div>
            <!-- 右下部 -->
            <div class="bei-down">
              <div class="home-shrimp-size">
                <img
                  :src="v.pic"
                  alt=""
                  class="home-lr-size"
                  v-for="(v, i) of this.b3"
                  :key="i"
                />
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 国家馆 -->
      <div class="country">
        <div class="country-word">国家馆</div>
        <div class="five-country">
          <div class="every-country">
            <img
              src="../../public/img/index/index_lap/world/canada.jpg"
              alt=""
              class="country-pic"
            />
            <div class="country-china">加拿大</div>
            <div class="country-english">Canada</div>
          </div>
          <div class="every-country">
            <img
              src="../../public/img/index/index_lap/world/new_zlind.jpg"
              alt=""
              class="country-pic"
            />
            <div class="country-china">新西兰</div>
            <div class="country-english">New Zealind</div>
          </div>
          <div class="every-country">
            <img
              src="../../public/img/index/index_lap/world/uk.jpg"
              alt=""
              class="country-pic"
            />
            <div class="country-china">英国</div>
            <div class="country-english">UK</div>
          </div>
          <div class="every-country">
            <img
              src="../../public/img/index/index_lap/world/usa.jpg"
              alt=""
              class="country-pic"
            />
            <div class="country-china">美国</div>
            <div class="country-english">USA</div>
          </div>
          <div class="every-country">
            <img
              src="../../public/img/index/index_lap/world/zhili.jpg"
              alt=""
              class="country-pic"
            />
            <div class="country-china">智利</div>
            <div class="country-english">CHILE</div>
          </div>
        </div>
      </div>
    </main>
    <my-footer></my-footer>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      //  首页轮播图
      c: [],
      // 热门推荐
      h: [],
      //鱼类
      f1: {},
      f2: {},
      f3: {},
      f4: {},
      f_other: [],
      // 虾类
      s1: {},
      s2: [],
      s3: [],
      //蟹类
      c1: {},
      c2: {},
      c3: {},
      c4: {},
      c5: {},
      c6: {},
      // 虾类
      b1: {},
      b2: [],
      b3: [],
      //国家馆
    };
  },
  mounted() {
    // 轮播图
    axios.get("/carousel").then((result) => {
      console.log(result.data);
      [...this.c] = result.data;
      // console.log(this.c);
    });
    // 首页推荐商品
    axios.get("/item").then((result) => {
      console.log(result.data);
      [...this.h] = result.data.slice(0, 4);
      // console.log(this.h)
    });
    // 鱼类
    axios.get("/item").then((result) => {
      console.log(result.data);
      [this.f1, this.f2, this.f3, this.f4, ...this.f_other] = result.data.slice(
        4,
        14
      );
      console.log(this.f1);
    });
    // 虾类
    axios.get("/item").then((result) => {
      console.log(result.data);
      [this.s1] = result.data.slice(14, 15);
      console.log(this.s1);
      [...this.s2] = result.data.slice(15, 18);
      [...this.s3] = result.data.slice(18, 20);
    });
    //蟹类
    axios.get("/item").then((result) => {
      console.log(result.data);
      [this.c1, this.c2, this.c3, this.c4, this.c5, this.c6] =
        result.data.slice(20, 26);
      // console.log(this.c3);
    });
    //贝类
    axios.get("/item").then((result) => {
      console.log(result.data);
      [this.b1] = result.data.slice(26, 27);
      console.log(this.b1);
      [...this.b2] = result.data.slice(27, 30);
      [...this.b3] = result.data.slice(30, 32);
    });
  },
  methods: {
    golist() {
      this.$router.push("/list");
    },
  },
};
</script>
<style>
* {
  padding: 0;
  margin: 0;
}
p {
  margin: 0 0 10px;
}
body {
  font-family: "微软雅黑", Arial;
  font-size: 12px !important;
  background-color: #f4f4f4;
}

.main {
  width: 100%;
}
main > div:nth-child(2) > div,
main > div:nth-child(3) > div,
main > div:nth-child(4) > div,
main > div:nth-child(5) > div,
main > div:nth-child(6) > div,
main > div:nth-child(7) > div,
main > div:nth-child(8) > div {
  transform: translateY(3px);
  cursor: pointer;
}

/* 首页导航的样式 */
/* 导航 */
.index-content {
  width: 100%;
  height: 36px;
  margin: 0 16px 0 16px;
  background-color: #f9f9f9;
}

.index-content div {
  padding-left: 45px;
  display: inline-block;
  font-size: 15px;
  font-weight: bold;
  line-height: 36px;
  cursor: pointer;
}

.index-content div:nth-child(1) {
  width: 191px;
  padding: 0;
}

/* 轮播图 */
.block {
  height: 100%;
  width: 100%;
}
.el-carousel__item img {
  width: 100%;
  height: 100%;
}

/* .el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}  */
/* 三级分类 */
.home-five-style {
  width: 1200px;
  margin: auto;
  position: absolute;
  top: 209px;
  left: 15px;
  bottom: 0;
  right: 0;
  overflow: auto;
}

.home-five-detail {
  width: 191px;
  height: 402px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.7);
  color: white;
}
.home-five-detail .home-have-line:hover {
  color: black !important;
  background-color: #fff;
}

/* 具体三级分类项 */
.three big {
  width: 191px;
  height: 40px;
  background: rgba(14, 14, 18, 1);
  opacity: 0.8;
}

.home-have-line {
  width: 160px;
  height: 30px;
  line-height: 30px;
  padding-top: 7px;
  /* border-bottom: 1px solid rgba(255,255,255,0.8); */
  margin-left: 31px;
  margin-top: 6px;
}

#showOneThree div.three-big:nth-child(1) .fish-small {
  display: inline-block;
  width: 30px;
  height: 30px;
  background: url("https://www.ewfresh.com/images/homeNewClass.png") no-repeat
    5px -66px;

  color: white;
}

.first-class span:nth-child(2) {
  display: inline-block;
  margin-left: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.first-class span:nth-child(3) {
  color: #cccccc;
  float: right;
  margin-right: 30px;
  font-size: 12px;
  font-weight: 700;
}

/* 热门推荐 */
.home-hot-record {
  width: 1200px;
  height: 300px;
  margin: 0 auto;
  background: url(../../public/img/index/hotToYou.png) no-repeat;
  margin-top: 30px;
}

.home-hot-word {
  width: 1200px;
  text-align: center;
  padding-top: 30px;
  padding-bottom: 20px;
  font-size: 24px;
}
.four-recond {
  display: flex;
}
.four-recond > img {
  width: 290px;
  height: 172px;
}

/* 鱼类专区 */
.fish,
.shrimp,
.crab,
.bei {
  width: 1200px;
  height: 626px;
  margin: 0 auto;
}

/* 文字部分 */
.fish-word,
.shrimp-word,
.crab-word,
.bei-word {
  width: 100%;
  height: 106px;
  font-size: 0;
}

.im-cursor {
  cursor: pointer;
}

/* 下划线 */
.fish-fine-line,
.shrimp-fine-line,
.crab-fine-line,
.bei-fine-line {
  display: inline-block;
  width: 480px;
  height: 64px;
  border-bottom: 1px solid #b7c8e3;
  margin: 0;
}

.fish-coarse-line,
.shrimp-coarse-line,
.crab-coarse-line,
.bei-coarse-line {
  display: inline-block;
  width: 45px;
  height: 63px;
  border-bottom: 2px solid #6b7ea3;
}

/* 鱼具体文字 */
.fish-big,
.shrimp-big,
.crab-big,
.bei-big {
  display: inline-block;
  width: 140px;
  text-align: center;
  color: #ababab;
  font-size: 24px;
  font-weight: 600;
}

/* 更多类别 */
.fish-more,
.shrimp-more,
.crab-more,
.bei-more {
  font: 12px/1 Tahoma, Helvetica, Arial, "微软雅黑", Arial, "\5b8b\4f53",
    sans-serif;
  text-align: right;
  line-height: 19px;
}

.fish-more span,
.shrimp-more span,
.crab-more span,
.bei-more span {
  display: inline-block;
  color: #707070;
  font-weight: 600;
}

.fish-more img,
.shrimp-more img,
.crab-more img,
.bei-more img {
  width: 15px;
  height: 15px;
  margin-top: -2px;
  vertical-align: middle;
}

/* 鱼类内容 */
.fish-detail {
  height: 520px;
  width: 1200px;
}

.fish-detail > div:nth-child(1) {
  width: 388px;
  height: 520px;
  float: left;
  margin-right: 18px;
  position: relative;
}

.fish-detail > div:nth-child(2) {
  width: 388px;
  height: 520px;
  border-radius: 5px;
  background: white;
  float: left;
  margin-right: 18px;
}

.fish-detail > div:nth-child(3) {
  width: 388px;
  height: 520px;
  float: left;
}

.fish-detail > div:nth-child(2) > .fish-small {
  margin: 28px;
  font-size: 0;
}

.fish-six img:nth-child(1),
.fish-six img:nth-child(2),
.fish-six img:nth-child(4),
.fish-six img:nth-child(5) {
  width: 102px;
  height: 76px;
  margin-right: 9px;
  margin-bottom: 5px;
}

.fish-six img:nth-child(3) {
  width: 102px;
  height: 76px;
  margin-bottom: 5px;
}

.fish-six img:nth-child(6) {
  width: 102px;
  height: 76px;
}

.fish-three img:first-child,
.fish-three img:first-child {
  margin-bottom: 20px;
}

/* 虾类 */
/* 虾类具体内容 */
.shrimp-detail .shrimp-one,
.bei-detail .bei-one {
  float: left;
  margin-right: 18px;
}

.shrimp-detail .shrimp-two,
.bei-detail .bei-two {
  width: 604px;
  height: 520px;
  float: left;
}

.shrimp-up,
.bei-up {
  width: 100%;
  height: 195px;
  background: white;
  border-radius: 5px;
  margin-bottom: 17px;
}

.shrimp-up > div:first-child,
.bei-up > div:first-child {
  height: 72px;
  line-height: 72px;
}

.shrimp-up > div:nth-child(2),
.bei-up > div:nth-child(2) {
  width: 560px;
  height: 100px;
  margin-left: 22px;
  font-size: 0;
}

.shrimp-up > div:nth-child(2) img,
.bei-up > div:nth-child(2) img {
  width: 180px;
  height: 100px;
  margin-right: 6px;
}

.shrimp-down,
.bei-down {
  width: 604px;
  height: 308px;
  background: white;
  border-radius: 5px;
}

.shrimp-down .home-shrimp-size,
.bei-down .home-bei-size {
  width: 560px;
  height: 246px;
  margin-left: 22px;
  padding-top: 31px;
}

.wid-th-fi {
  width: 35px;
  height: 35px;
}

.shrimp-two .home-up-word .shrimp-ice,
.bei-two .home-up-word .bei-ice {
  font-size: 18px;
  font-weight: 600;
  /* background: none; */
  color: #b2b2b2;
}

.home-lr-size {
  width: 274px;
  height: 246px;
}

/* 蟹类内容 */
.crab-deatil {
  height: 520px;
  width: 1200px;
}

.crab-deatil div:first-child,
.crab-deatil div:nth-child(2),
.crab-deatil div:nth-child(3) {
  width: 388px;
  height: 520px;
  margin-right: 18px;
  float: left;
}

.crab-one > img {
  width: 388px;
  height: 250px;
  background-color: #fff;
}

.crab-one > img:nth-child(1) {
  margin-bottom: 20px;
}

/* 蟹类右边 */
.crab-three .crab-small {
  width: 346px;
  height: 480px;
  margin-left: 21px;
}

.crab-word {
  width: 100%;
  height: 72px !important;
  line-height: 72px;
}

.crab-word .new-goods {
  font-size: 18px;
  font-weight: 600;
  /* background: none; */
  color: #b2b2b2;
}

.crab-small .premium-up {
  margin-bottom: 20px;
}

/* 国家馆 */
.country {
  width: 1200px;
  height: 326px;
  margin: 0 auto;
  background: url(https://www.ewfresh.com/images/countryIsFive.png) no-repeat;
  margin-top: 43px;
  margin-bottom: 50px;
}

.country .country-word {
  width: 100%;
  text-align: center;
  padding-top: 30px;
  padding-bottom: 20px;
  font-size: 24px;
}

.country .five-country {
  width: 1088px;
  height: 242px;
  margin-left: 56px;
}

.country .five-country div:last-child {
  margin: 0;
}

.five-country > div {
  width: 160px;
  height: 242px;
  float: left;
  margin-right: 72px;
  font-size: 0;
}

.country-pic {
  width: 160px;
  height: 160px;
  display: inline-block;
  vertical-align: middle;
}

.country-china {
  width: 160px;
  text-align: center;
  font-size: 16px;
  margin-top: 17px;
  font-weight: 600;
}

.country-english {
  width: 160px;
  text-align: center;
  font-size: 14px;
  color: #898989;
}
</style>
